#pragma once
#include <iostream>
#include <pthread.h>
class Lockguard
{
private:
    pthread_mutex_t *_mutex;
public:
    Lockguard(pthread_mutex_t *mutex):_mutex(mutex)
    {
        pthread_mutex_lock(_mutex);
    }
    ~Lockguard()
    {
        pthread_mutex_unlock(_mutex);
    }
};
